public class Instance {
    private int num_c; // 客户点数量
    private int num_od; // OD数量
    private int Q; // RD载量
    private double max_dev; // maximum detour length（最大绕行距离）
    private double rho; // compensation factor for ODs (per distance unit of the detours)
    private int[][] nodes; // vertices (depot + customers + ODs)
    private int[][] nodesRD; // vertices (depot + customers)
    private double[][] dis;

    public Instance(int num_c, int num_od, int q, double max_dev, double rho, int[][] customer, int[][] od) {
        this.num_c = num_c;
        this.num_od = num_od;
        Q = q;
        this.max_dev = max_dev;
        this.rho = rho;
        this.nodesRD = customer;
        nodes = new int[num_c + num_od][2];
        for (int i = 0; i < customer.length; i++) {
            nodes[i][0] = customer[i][0];
            nodes[i][1] = customer[i][1];
        }
        for (int i = 0; i < od.length; i++) {
            nodes[od[i][0]][0] = od[i][1];
            nodes[od[i][0]][1] = od[i][2];
        }
        // 计算距离矩阵
        dis = new double[nodes.length][nodes.length];
        for (int i = 0; i < dis.length; i++) {
            dis[i][i] = Double.MAX_VALUE;
            for (int j = 0; j < i; j++) {
                dis[i][j] = Math.sqrt((nodes[i][0] - nodes[j][0]) * (nodes[i][0] - nodes[j][0]) + (nodes[i][1] - nodes[j][1]) * (nodes[i][1] - nodes[j][1]));
                dis[j][i] = dis[i][j];
            }
        }
    }

    public int getNum_c() {
        return num_c;
    }

    public int getNum_od() {
        return num_od;
    }

    public int getQ() {
        return Q;
    }

    public double getMax_dev() {
        return max_dev;
    }

    public double getRho() {
        return rho;
    }

    public int[][] getNodes() {
        return nodes;
    }

    public int[][] getNodesRD() {
        return nodesRD;
    }

    public double[][] getDis() {
        return dis;
    }
}